package com.example.bbs.controller;


import com.example.bbs.entity.Article;
import com.example.bbs.entity.Doctor;
import com.example.bbs.service.DoctorService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpSession;
import java.util.HashMap;
import java.util.List;

/***
 * @author jiaziyun
 * @since 2021-04-30
 */
@Controller
@RequestMapping("/admin")
public class AdminController {
    @Autowired
    private DoctorService doctorService;

    @RequestMapping()
    public String loginindex() {
        return "adminlogin";
    }

    //管理员登录后首页,认证部分
    @RequestMapping("/index")
    public String addArticle(Model model) {
        List<Doctor> allDoc = doctorService.getAllDoc();
        model.addAttribute("doctors", allDoc);
        return "administer";
    }

    //认证更新
    @RequestMapping("/submit-certifcinfo")
    @ResponseBody
    public String setCertficInfo(@RequestBody HashMap<String, String> parmmao) {
        return doctorService.setDocInfoById(parmmao);
    }


}
